#include <iostream>
#include <string>
using namespace std;
int main() {
    std::string str;
    std::string ret;
    std::cin >> str;
    for(char ch : str){
        if(ret.empty()||ret.back() != ch){
            ret.push_back(ch);
        }
        else{
            ret.pop_back();
        }
    }
    std::cout << (ret.empty() ? "0" : ret);
    return 0;
}
